home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Network / Batch Launch / Batch Launcher
Encoding:
Text File  |  1999-03-04  |  2.0 KB  |  73 lines  |  [TEXT/ToyS]

  1. property gasFriendlyUser : "CasaVision" -- Our friend on all machines
  2. property gasFriendlyPass : "" -- Our friend's password on all machines
  3. property gasFriendSet : false -- Has the friend been asked for?
  4.  
  5. property kasAllowAlerts : true -- Set to false to stop warnings about missed servers
  6.  
  7. property kasOurFolder : ":Remote Files:"
  8. -- property kasOurFolder : "◊LIFE◊:Abaton:Athena:Agents:osax:Akua Sweets Examples:Remote Launcher:Remote Files:" -- For testing
  9.  
  10.  
  11. on run
  12.     GetFriend() -- Make sure we have a friendly user
  13.     
  14.     set myFolder to kasOurFolder
  15.     
  16.     set myFiles to list folder (myFolder as alias)
  17.     
  18.     repeat with f in myFiles
  19.         open {alias (myFolder & f)}
  20.     end repeat
  21. end run
  22.  
  23.  
  24. on open fsObjs
  25.     repeat with f in fsObjs
  26.         set myAlias to «event ÅkuFFiLA» f
  27.         set myInfo to alias info from myAlias
  28.         set myServer to alias server of myInfo
  29.         set myZone to alias zone of myInfo
  30.         
  31.         talk as user gasFriendlyUser ¬
  32.             with password gasFriendlyPass ¬
  33.             on server myServer ¬
  34.             in AppleTalk zone myZone
  35.         
  36.         try
  37.             -- Don't wait for a response, assume the aliases are correct
  38.             ignoring application responses
  39.                 tell application "Finder" of machine myServer of zone myZone to open myAlias
  40.             end ignoring
  41.         on error
  42.             if (kasAllowAlerts) then
  43.                 ShowAlert("Couldn't link to Finder on " & myServer & " in zone " & myZone & ".")
  44.             else
  45.                 beep
  46.             end if
  47.         end try
  48.     end repeat
  49. end open
  50.  
  51.  
  52. on GetFriend()
  53.     if not gasFriendSet then
  54.         set chosen to display dialog ¬
  55.             "Enter the friendly user's name…" default answer gasFriendlyUser default button 2 with icon stop
  56.         
  57.         if (the button returned of chosen is "OK") then ¬
  58.             set gasFriendlyUser to the text returned of chosen
  59.         
  60.         set chosen to display dialog "Enter the friendly user's password…" default answer gasFriendlyPass default button 2 with icon stop
  61.         
  62.         if (the button returned of chosen is "OK") then ¬
  63.             set gasFriendlyPass to the text returned of chosen
  64.         
  65.         set gasFriendSet to true
  66.     end if
  67. end GetFriend
  68.  
  69.  
  70. on ShowAlert(msgStr)
  71.     display dialog msgStr buttons {"Damn!"} default button 1
  72. end ShowAlert
  73.